%% start of file `moderncvheadi.sty'.
%% Copyright 2006-2015 Xavier Danaux (xdanaux@gmail.com).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.


%-------------------------------------------------------------------------------
%                identification
%-------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{coverletter}[2019/05/10 v1.0.0 cover letter modify from moderncv]
\RequirePackage{ifthen}
\RequirePackage{xcolor}

% fonts
\newcommand*{\namefont}{}
\newcommand*{\titlefont}{}
\newcommand*{\addressfont}{}
\newcommand*{\quotefont}{}
\newcommand*{\sectionfont}{}
\newcommand*{\subsectionfont}{}
\newcommand*{\hintfont}{}
\newcommand*{\pagenumberfont}{\addressfont\itshape}

% styles
\newcommand*{\namestyle}[1]{{\namefont#1}}
\newcommand*{\titlestyle}[1]{{\titlefont#1}}
\newcommand*{\addressstyle}[1]{{\addressfont#1}}
\newcommand*{\quotestyle}[1]{{\quotefont#1}}
\newcommand*{\sectionstyle}[1]{{\sectionfont#1}}
\newcommand*{\subsectionstyle}[1]{{\subsectionfont#1}}
\newcommand*{\hintstyle}[1]{{\hintfont#1}}
\newcommand*{\pagenumberstyle}[1]{{\pagenumberfont#1}}

% colors
%-------
\definecolor{color0}{rgb}{0,0,0}% main default color, normally left to black
\definecolor{color1}{rgb}{0,0,0}% primary scheme color
\definecolor{color2}{rgb}{0,0,0}% secondary scheme color
\definecolor{color3}{rgb}{0,0,0}% tertiary scheme color

\renewcommand{\name}[1]{
  \def\@name{#1}
  \centerline{\Huge\scshape{#1}}
  \vspace{1.25ex}
}

\renewcommand{\email}[1]{
	\def\@email{#1}
	\faEnvelope\ \href{mailto:#1}{#1}
}
\renewcommand{\phone}[1]{
	\def\@phone{#1}
	\faPhone\ {#1}
}


%-------------------------------------------------------------------------------
%                letter design commands definitions
%-------------------------------------------------------------------------------
% elements
\newcommand*{\enclname}{Enclosure}
\newcommand*{\recipient}[2]{\def\@recipientname{#1}\def\@recipientaddress{#2}}
\renewcommand*{\date}[1]{\def\@date{#1}}\date{\today}
\newcommand*{\opening}[1]{\def\@opening{#1}}
\newcommand*{\closing}[1]{\def\@closing{#1}}
\newcommand*{\enclosure}[2][]{%
  % if an optional argument is provided, use it to redefine \enclname
  \ifthenelse{\equal{#1}{}}{}{\renewcommand*{\enclname}{#1}}%
  \def\@enclosure{#2}}

% recompute all letter lengths
\newcommand*{\recomputeletterheadlengths}{}
\newcommand*{\recomputeletterbodylengths}{}
\newcommand*{\recomputeletterfootlengths}{}
\newcommand*{\recomputeletterlengths}{%
  \recomputeletterheadlengths%
  \recomputeletterbodylengths%
  \recomputeletterfootlengths}

% makes the letter title
% usage: \makelettertitle
\newcommand*{\makelettertitle}{%
  \makeletterhead%
  \makeletterfoot}
\newcommand*{\makeletterhead}{
  \hfill%
  \begin{minipage}{.5\textwidth}%
      \raggedleft%
      \addressfont\textcolor{color2}{%
        {\bfseries\upshape\@name}%
	  }	
    \end{minipage}\\[1em]
  % recipient block
  \begin{minipage}[t]{.5\textwidth}
    \raggedright%
    \addressfont%
    {\bfseries\upshape\@recipientname}\\%
    \@recipientaddress%
  \end{minipage}
  % date
  \hfill% US style
%  \\[1em]% UK style
  \@date\\[2em]% US informal style: "January 1, 1900"; UK formal style: "01/01/1900"
  % opening
  \raggedright%
  \@opening\\[1.5em]%
  % ensure no extra spacing after \makelettertitle due to a possible blank line
%  \ignorespacesafterend% not working
  \hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}
}

\newcommand*{\makeletterfoot}{
}

% makes the letter closing
% usage: \makeletterclosing
\newcommand*{\makeletterclosing}{
\vspace{1cm}\par
\textit{\@closing}\par
\textbf{\@name}
}
  
\endinput


%% end of file `coverletter.sty'.
